package org.jsola.hr.web;

import org.jsola.approval.dto.UserApproAddDTO;
import org.jsola.approval.entity.ApproFlowNode;
import org.jsola.core.Result;
import org.jsola.hr.constant.HrConstants;
import org.jsola.hr.provider.IApproProviderService;
import org.jsola.user.core.TokenUser;
import org.jsola.user.core.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 员工考勤月统计归档
 *
 * @author zhr
 */
@RestController("hrUserApproController")
@RequestMapping(HrConstants.API_PATH + "/v1/userAppros")
public class UserApproController implements IUserApproControllerAPI {

    @Autowired
    protected IApproProviderService approProviderService;


    @Override
    @PostMapping("/getFlowProcessByApproInfo")
    public Result<List<ApproFlowNode>> getFlowProcessByApproInfo(@RequestBody @Validated UserApproAddDTO userApproAddDTO) {
        TokenUser tokenUser = UserContext.getUser();
        // todo 查看人员申请审批表权限校验

        return Result.success(approProviderService.getFlowProcessByApproInfo(userApproAddDTO, tokenUser));
    }


}

